//
// PPAssetsPickerViewController.h
// PPAssetsPickerViewController
//
// Created by Jinxiao on 9/13/16.
// Copyright © 2016 MicroDream. All rights reserved.
//

@import AVFoundation;

@class ALAsset;
@class PPAssetsPickerViewCell;
@class PPAssetsPickerViewController;

@protocol PPAssetsPickerViewControllerDelegate <NSObject>

- (void)assetsPickerViewControllerDidPressConfirm:(PPAssetsPickerViewController *)assetsPickerViewController;
- (void)assetsPickerViewControllerDidPressCancel:(PPAssetsPickerViewController *)assetsPickerViewController;

@end

@interface PPAssetsPickerViewController : PPAbstractViewController <UICollectionViewDelegate, UICollectionViewDataSource>

@property (readwrite, nonatomic, weak) id<PPAssetsPickerViewControllerDelegate> delegate;

@property (readonly) NSArray <ALAsset *> *selectedAssets;

@property (readwrite, nonatomic, strong) id userInfo;

@property (readwrite, nonatomic, assign) BOOL hideCamera;

- (void)didChangeSelection:(BOOL)selection forAsset:(ALAsset *)asset;

@end


@protocol PPAssetsPickerViewCellDelegate <NSObject>

- (void)assetsPickerViewCell:(PPAssetsPickerViewCell *)assetsPickerViewCell didChangeSelection:(BOOL)selection forAsset:(ALAsset *)asset;

@end

@interface PPAssetsPickerViewCell : UICollectionViewCell

@property (readwrite, nonatomic, strong) ALAsset *asset;

@property (readwrite, nonatomic, weak) id<PPAssetsPickerViewCellDelegate> delegate;

@property (readonly) UIImageView *imageView;
@property (readonly) UIButton *selectButton;

@end

@interface PPAssetsPickerViewCaptureCell : UICollectionViewCell <AVCaptureMetadataOutputObjectsDelegate>

@property (nonatomic, strong) AVCaptureDevice *device;
@property (nonatomic, strong) AVCaptureDeviceInput *input;
@property (nonatomic, strong) AVCaptureMetadataOutput *output;
@property (nonatomic, strong) AVCaptureSession *session;
@property (nonatomic, strong) AVCaptureVideoPreviewLayer *preview;

- (void)startCapture;
- (void)stopCapture;

@property (readwrite, nonatomic, strong) UIVisualEffectView *blurView;
@property (readwrite, nonatomic, strong) UIImageView *logoView;

@end
